package com.sale24h.data.adapter;

import java.util.List;

import com.example.sale24h.R;
import com.example.sale24h.R.id;
import com.sale24h.data.clsChiTietBan;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ChonMonAdapter extends ArrayAdapter<clsChiTietBan>
{
	private List<clsChiTietBan> lstChiTietBans;
	private Context context;
	public ChonMonAdapter(Context context, int resource,
			List<clsChiTietBan> objects)
	{
		super(context, resource, objects);
		// TODO Auto-generated constructor stub
		this.context=context;
		this.lstChiTietBans=objects;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		LayoutInflater inflater = (LayoutInflater)this.context
		        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View rootView=inflater.inflate(R.layout.itemmongoi_layout, parent,false);
		
		TextView tbxsoluong=(TextView)rootView.findViewById(id.tbxsoluong);
		clsChiTietBan listchitietban=lstChiTietBans.get(position);
		tbxsoluong.setText(String.valueOf(listchitietban.getSoluong()));
		
		TextView tbxTenHang=(TextView)rootView.findViewById(id.tbxtenmon);
		tbxTenHang.setText(listchitietban.getTenhang());
		
		TextView tbxdongia=(TextView)rootView.findViewById(id.tbxTenBan);
		tbxdongia.setText(String.valueOf(listchitietban.getDongia1()));
		
		return rootView;
	}
	

}
